Skip to content

[fix](be) Report stream load size limits in MiB - #66224

Open
0AyanamiRei wants to merge 3 commits into
apache:masterfrom
0AyanamiRei:fix/stream-load-json-size-unit
Open

[fix](be) Report stream load size limits in MiB#66224
0AyanamiRei wants to merge 3 commits into
apache:masterfrom
0AyanamiRei:fix/stream-load-json-size-unit

Conversation

@0AyanamiRei

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary:

Stream Load body-size limit errors display raw byte counts next to BE configuration items whose names and values are expressed in MB, making the message misleading. Report both the actual body size and configured limit in MiB for JSON Stream Load, CSV Stream Load, and HTTP Stream. The limit calculation and rejection behavior are unchanged.

Release note

Report Stream Load body-size limit errors consistently in MiB.

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason

    ./run-be-ut.sh --run --filter=StreamLoadTest.* -j48 (4 tests passed)

  • Behavior changed:

    • No.
    • Yes. JSON and CSV Stream Load size-limit errors now display both values in MiB.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: JSON Stream Load body-size errors displayed both byte counts without units next to a configuration named streaming_load_json_max_mb, making the configured limit misleading. Keep the existing threshold and byte comparison unchanged, label both exact byte values, and show the snapshotted configured MB value. Add a BE unit test using the reported request size.

### Release note

Clarify units in the JSON Stream Load body-size limit error message.

### Check List (For Author)

- Test: Unit Test
    - ./run-be-ut.sh --run --filter=StreamLoadTest.* -j48 (2 tests passed)
- Behavior changed: Yes. The JSON Stream Load size-limit error now identifies byte values and the configured MB value.
- Does this need documentation: No
### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Stream Load size-limit errors mixed byte counts with configuration names expressed in MB, which made both JSON and CSV failures misleading. Report the actual request size and configured limit consistently in MiB for JSON Stream Load, CSV Stream Load, and HTTP Stream without changing any thresholds or rejection behavior. Add BE unit coverage for all three paths.

### Release note

Report Stream Load body-size limit errors consistently in MiB.

### Check List (For Author)

- Test: Unit Test
    - ./run-be-ut.sh --run --filter=StreamLoadTest.* -j48 (4 tests passed)
- Behavior changed: Yes. JSON and CSV Stream Load size-limit errors now display both values in MiB.
- Does this need documentation: No
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@0AyanamiRei

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 28941 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 09fa8751ae439d0d4d2a2f5ffc73ca52ec6c1a0d, data reload: false

------ Round 1 ----------------------------------
============================================
q1	18122	3970	3933	3933
q2	2426	341	203	203
q3	10817	1359	812	812
q4	4964	459	338	338
q5	8591	847	563	563
q6	205	168	136	136
q7	794	796	613	613
q8	11975	1506	1555	1506
q9	7112	4326	4362	4326
q10	7563	1718	1467	1467
q11	809	345	317	317
q12	941	573	463	463
q13	19193	3396	2709	2709
q14	287	265	240	240
q15	q16	814	780	697	697
q17	1327	1016	1017	1016
q18	7553	5967	5415	5415
q19	1686	1236	1021	1021
q20	784	697	602	602
q21	5577	2528	2264	2264
q22	413	349	300	300
Total cold run time: 111953 ms
Total hot run time: 28941 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4404	4271	4285	4271
q2	299	320	211	211
q3	4579	4910	4399	4399
q4	2015	2123	1349	1349
q5	4666	4385	4567	4385
q6	247	179	127	127
q7	1827	1698	1483	1483
q8	2255	2062	1990	1990
q9	7578	7760	7572	7572
q10	4642	4579	4174	4174
q11	558	401	390	390
q12	767	750	522	522
q13	3288	3514	2944	2944
q14	283	292	260	260
q15	q16	666	697	614	614
q17	1265	1258	1245	1245
q18	7681	7017	6937	6937
q19	1112	1101	1074	1074
q20	2210	2244	2024	2024
q21	5418	4803	4666	4666
q22	535	502	411	411
Total cold run time: 56295 ms
Total hot run time: 51048 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 176946 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 09fa8751ae439d0d4d2a2f5ffc73ca52ec6c1a0d, data reload: false

query5	4394	630	489	489
query6	510	242	200	200
query7	4974	610	331	331
query8	450	194	171	171
query9	8744	4106	4080	4080
query10	510	362	309	309
query11	5883	2312	2145	2145
query12	157	105	105	105
query13	1281	572	427	427
query14	6796	5181	4859	4859
query14_1	4234	4224	4196	4196
query15	227	204	185	185
query16	4079	485	483	483
query17	1254	745	562	562
query18	2605	490	374	374
query19	298	180	144	144
query20	112	102	101	101
query21	924	163	133	133
query22	14748	14382	13619	13619
query23	17280	16471	16012	16012
query23_1	16137	16213	16266	16213
query24	7542	1768	1275	1275
query24_1	1287	1273	1309	1273
query25	565	453	388	388
query26	1416	359	216	216
query27	2257	566	393	393
query28	4385	2017	2007	2007
query29	925	620	494	494
query30	481	258	220	220
query31	1116	1091	988	988
query32	126	60	59	59
query33	558	311	260	260
query34	1239	1128	647	647
query35	758	767	664	664
query36	1016	1020	888	888
query37	142	99	85	85
query38	1904	1693	1646	1646
query39	894	864	870	864
query39_1	847	843	836	836
query40	363	157	144	144
query41	68	65	66	65
query42	97	91	91	91
query43	325	323	279	279
query44	1398	779	763	763
query45	189	180	172	172
query46	1010	1228	765	765
query47	2141	2092	2007	2007
query48	412	395	294	294
query49	663	413	308	308
query50	1032	408	327	327
query51	10748	10714	10429	10429
query52	86	87	76	76
query53	265	271	206	206
query54	325	241	229	229
query55	74	71	67	67
query56	300	295	287	287
query57	1672	1343	1173	1173
query58	293	268	253	253
query59	1549	1640	1439	1439
query60	322	270	250	250
query61	151	146	142	142
query62	538	495	431	431
query63	243	199	193	193
query64	1761	984	839	839
query65	4736	4601	4621	4601
query66	1723	509	378	378
query67	29413	29293	29080	29080
query68	3252	1516	1044	1044
query69	653	297	265	265
query70	906	820	794	794
query71	381	327	331	327
query72	3517	2704	2438	2438
query73	842	779	452	452
query74	5078	4960	4729	4729
query75	2542	2496	2123	2123
query76	1884	1153	796	796
query77	348	364	268	268
query78	11969	11985	11338	11338
query79	2094	1156	735	735
query80	1281	555	478	478
query81	720	331	277	277
query82	645	155	120	120
query83	371	322	302	302
query84	472	163	132	132
query85	1148	643	513	513
query86	458	231	223	223
query87	1821	1819	1746	1746
query88	3748	2790	2797	2790
query89	455	362	321	321
query90	1945	197	191	191
query91	201	192	182	182
query92	57	62	55	55
query93	1877	1514	949	949
query94	770	361	307	307
query95	777	493	571	493
query96	1051	884	365	365
query97	2638	2598	2509	2509
query98	243	205	203	203
query99	1153	1102	972	972
Total cold run time: 272654 ms
Total hot run time: 176946 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 25.16 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 09fa8751ae439d0d4d2a2f5ffc73ca52ec6c1a0d, data reload: false

query1	0.01	0.00	0.01
query2	0.45	0.05	0.05
query3	0.70	0.14	0.13
query4	2.34	0.13	0.13
query5	0.23	0.22	0.23
query6	1.82	1.12	1.08
query7	0.03	0.01	0.00
query8	0.06	0.04	0.04
query9	0.66	0.34	0.31
query10	0.55	0.58	0.56
query11	0.36	0.13	0.15
query12	0.24	0.14	0.14
query13	0.48	0.47	0.48
query14	1.03	1.01	1.01
query15	0.62	0.58	0.59
query16	0.32	0.33	0.30
query17	1.11	1.13	1.09
query18	0.23	0.21	0.22
query19	2.33	1.94	2.16
query20	0.02	0.01	0.01
query21	16.96	0.19	0.13
query22	4.79	0.05	0.06
query23	16.88	0.30	0.13
query24	15.26	0.45	0.37
query25	0.15	0.07	0.04
query26	0.76	0.20	0.14
query27	0.04	0.05	0.03
query28	3.51	0.93	0.58
query29	12.85	4.16	3.29
query30	0.28	0.16	0.15
query31	2.88	0.59	0.32
query32	3.43	0.59	0.49
query33	3.20	3.19	3.22
query34	15.64	4.27	3.53
query35	3.51	3.53	3.54
query36	0.61	0.44	0.43
query37	0.19	0.07	0.06
query38	0.06	0.04	0.04
query39	0.09	0.03	0.03
query40	0.21	0.16	0.15
query41	0.27	0.03	0.03
query42	0.15	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 115.35 s
Total hot run time: 25.16 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (16/16) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 75.78% (31991/42216)
Line Coverage 60.38% (356364/590175)
Region Coverage 56.91% (298654/524769)
Branch Coverage 58.31% (134441/230571)

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: The JSON and CSV Stream Load size-limit errors did not use the requested wording for their BE configuration references. Update both messages to name BE's conf directly while preserving the existing limits and MiB conversion, and adjust the exact unit-test expectations.

### Release note

Improve JSON and CSV Stream Load size-limit error wording.

### Check List (For Author)

- Test: Unit Test
    - ./run-be-ut.sh --run --filter='StreamLoadTest.*' -j48
- Behavior changed: Yes (error message wording only)
- Does this need documentation: No
@0AyanamiRei

Copy link
Copy Markdown
Contributor Author

run buildall

@sollhui

sollhui commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review conclusion: request changes.

The change is small and focused, and the byte thresholds and rejection behavior are otherwise preserved. I found one user-visible correctness problem in the new diagnostics: requests just over a limit can be displayed as exactly equal to it because the body size is rounded to two fractional MiB digits. The inline comment covers the identical JSON Stream Load, CSV Stream Load, and HTTP Stream expressions.

Critical checkpoint conclusions:

  • Goal and proof: All three errors are converted to MiB and the new unit tests cover a representative 108.15 MiB rejection, but the fixed precision fails the exact over-limit boundary and there is no limit-plus-one test.
  • Scope and parallel paths: The implementation is localized. JSON line mode, CSV handling, HTTP Stream, chunked/no-Content-Length behavior, and the two mutable limit configs were reviewed; no distinct parallel-path regression was found.
  • Concurrency and lifecycle: The new values are request-local snapshots. The tests restore the mutable globals, use supported BE-UT private access, and return before their nullptr ExecEnv values are dereferenced; no new lock, lifecycle, or ownership issue was found.
  • Configuration and compatibility: No config is added. Supported-value thresholds and per-request dynamic-config behavior are unchanged. The error text changes intentionally; error codes, protocol/storage formats, and rolling-upgrade behavior are unaffected.
  • Data correctness, transactions, and FE/BE propagation: The change only formats a pre-transaction rejection and adds no transmitted or persisted state, so these invariants are unaffected.
  • Performance and observability: Conversion occurs only on the error path and adds no material cost. Existing error status and warning behavior remain sufficient.
  • Tests: The author reports ./run-be-ut.sh --run --filter=StreamLoadTest.* -j48 passing four tests. Per the review-runner instructions, this review was static and did not run builds or tests. Boundary coverage is still required for the accepted finding.

There was no additional user-provided review focus.

"json body size {} exceed BE's conf `streaming_load_json_max_mb` {}. increase "
"it if you are sure this load is reasonable",
ctx->body_bytes, json_max_body_bytes);
"json body size {:.2f} MiB exceeds the limit of {} MiB set by BE's conf "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The byte comparison is exact, but {:.2f} can round away the excess that triggered it. With a 100 MiB limit, Content-Length: 104857601 is rejected while this renders 100.00 MiB exceeds the limit of 100 MiB; the CSV branch and HttpStreamAction have the same issue. Please retain the exact byte count (for example alongside the friendly MiB value), or use a rendering policy that cannot display an over-limit value as equal, and add limit-plus-one coverage for all three paths.

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29650 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 4cf9d16f41d865ba8b68512b648279d5dc997dee, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17618	4221	4219	4219
q2	2007	346	205	205
q3	10307	1463	832	832
q4	4677	472	342	342
q5	7490	892	587	587
q6	189	176	136	136
q7	775	827	615	615
q8	9424	1556	1557	1556
q9	5558	4337	4358	4337
q10	6787	1724	1474	1474
q11	515	347	320	320
q12	729	584	450	450
q13	18070	3414	2765	2765
q14	268	270	255	255
q15	q16	796	777	705	705
q17	1028	1019	999	999
q18	6957	5711	5450	5450
q19	1322	1233	1114	1114
q20	783	662	591	591
q21	5918	2648	2403	2403
q22	436	365	295	295
Total cold run time: 101654 ms
Total hot run time: 29650 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4442	4371	4353	4353
q2	297	328	214	214
q3	4573	4951	4397	4397
q4	2073	2146	1371	1371
q5	4398	4290	4325	4290
q6	231	177	127	127
q7	1746	2002	1907	1907
q8	2615	2214	2223	2214
q9	8191	8126	7894	7894
q10	4715	4707	4267	4267
q11	591	409	387	387
q12	760	773	539	539
q13	3277	3559	2882	2882
q14	293	287	281	281
q15	q16	737	744	687	687
q17	1367	1342	1382	1342
q18	8130	7462	7395	7395
q19	1183	1091	1101	1091
q20	2189	2203	1942	1942
q21	5317	4558	4395	4395
q22	515	459	408	408
Total cold run time: 57640 ms
Total hot run time: 52383 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 177269 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 4cf9d16f41d865ba8b68512b648279d5dc997dee, data reload: false

query5	4315	624	484	484
query6	457	232	200	200
query7	4835	607	343	343
query8	332	193	169	169
query9	8764	4126	4105	4105
query10	493	368	288	288
query11	5761	2341	2125	2125
query12	161	104	103	103
query13	1302	612	438	438
query14	6246	5203	4909	4909
query14_1	4276	4269	4264	4264
query15	236	206	183	183
query16	998	469	471	469
query17	892	716	566	566
query18	2425	456	334	334
query19	207	182	149	149
query20	108	109	106	106
query21	233	162	141	141
query22	13548	13522	13323	13323
query23	17418	16519	16174	16174
query23_1	16306	16131	16141	16131
query24	7508	1751	1294	1294
query24_1	1305	1273	1271	1271
query25	543	435	359	359
query26	1325	344	215	215
query27	2654	614	385	385
query28	4477	2032	2024	2024
query29	1040	614	478	478
query30	347	270	220	220
query31	1111	1097	975	975
query32	99	63	61	61
query33	533	333	293	293
query34	1194	1206	648	648
query35	762	795	678	678
query36	1036	1045	919	919
query37	160	106	96	96
query38	1884	1707	1678	1678
query39	879	895	853	853
query39_1	839	847	837	837
query40	260	165	144	144
query41	69	66	62	62
query42	96	93	91	91
query43	317	325	279	279
query44	1501	771	787	771
query45	200	184	173	173
query46	1095	1195	728	728
query47	2165	2102	2028	2028
query48	405	410	304	304
query49	577	416	312	312
query50	1108	432	350	350
query51	10744	10703	10820	10703
query52	89	87	80	80
query53	260	290	204	204
query54	290	247	218	218
query55	75	72	72	72
query56	296	318	299	299
query57	1291	1292	1225	1225
query58	296	261	257	257
query59	1569	1636	1424	1424
query60	316	279	272	272
query61	177	156	156	156
query62	539	495	434	434
query63	249	204	202	202
query64	2870	1165	989	989
query65	4705	4664	4622	4622
query66	1843	523	402	402
query67	29270	28731	29232	28731
query68	3168	1686	1036	1036
query69	411	323	276	276
query70	922	826	832	826
query71	402	368	315	315
query72	3243	2908	2360	2360
query73	842	796	449	449
query74	5034	4996	4689	4689
query75	2558	2505	2123	2123
query76	2336	1162	772	772
query77	349	396	279	279
query78	11894	11821	11339	11339
query79	1391	1139	741	741
query80	1284	541	464	464
query81	564	330	297	297
query82	595	156	118	118
query83	388	339	300	300
query84	326	160	128	128
query85	964	663	521	521
query86	416	250	244	244
query87	1834	1810	1753	1753
query88	3790	2887	2837	2837
query89	435	374	320	320
query90	1955	203	193	193
query91	206	196	160	160
query92	65	62	53	53
query93	1728	1532	919	919
query94	730	360	314	314
query95	810	502	502	502
query96	1128	806	352	352
query97	2635	2637	2496	2496
query98	211	210	202	202
query99	1070	1112	967	967
Total cold run time: 263745 ms
Total hot run time: 177269 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 24.76 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 4cf9d16f41d865ba8b68512b648279d5dc997dee, data reload: false

query1	0.01	0.01	0.01
query2	0.09	0.04	0.05
query3	0.25	0.14	0.14
query4	1.60	0.14	0.13
query5	0.24	0.23	0.22
query6	1.16	0.81	0.83
query7	0.03	0.01	0.00
query8	0.06	0.04	0.04
query9	0.38	0.32	0.32
query10	0.54	0.57	0.54
query11	0.19	0.14	0.13
query12	0.17	0.14	0.14
query13	0.48	0.47	0.47
query14	1.03	1.01	1.00
query15	0.62	0.61	0.62
query16	0.31	0.31	0.32
query17	1.16	1.13	1.06
query18	0.22	0.21	0.21
query19	2.07	1.98	2.03
query20	0.01	0.01	0.01
query21	15.43	0.24	0.13
query22	4.71	0.06	0.05
query23	16.12	0.31	0.12
query24	2.98	0.41	0.33
query25	0.12	0.05	0.04
query26	0.71	0.21	0.15
query27	0.03	0.03	0.04
query28	3.58	0.88	0.51
query29	12.50	4.13	3.30
query30	0.27	0.18	0.16
query31	2.77	0.60	0.31
query32	3.23	0.60	0.48
query33	3.23	3.20	3.33
query34	15.64	4.20	3.48
query35	3.56	3.55	3.53
query36	0.55	0.43	0.42
query37	0.08	0.06	0.06
query38	0.06	0.03	0.04
query39	0.03	0.04	0.03
query40	0.18	0.17	0.14
query41	0.08	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 96.56 s
Total hot run time: 24.76 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (16/16) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 75.76% (31986/42220)
Line Coverage 60.38% (356347/590219)
Region Coverage 56.90% (298604/524794)
Branch Coverage 58.28% (134394/230597)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants